

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTabWidget>
#include <QTextEdit>
#include <QDir>
#include "scene.h"
#include "diagramitem.h"
#include "propertiesdialog.h"
#include "propertiesdiagram2.h"

QT_BEGIN_NAMESPACE
class QAction;
class QToolBox;
class QSpinBox;
class QComboBox;
class QFontComboBox;
class QButtonGroup;
class QLineEdit;
class QGraphicsItem;
class QFont;
class QToolButton;
class QAbstractButton;
class QGraphicsView;
class QSpacerItem;
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
   MainWindow();
	void deleteFunc(QGraphicsItem *item1);

private slots:
	void buttonGroupClicked(int id);
	void newFile();
	void open();
	bool save();
	bool saveAs();
	void about();
	void deleteItem();
	void itemInserted(DiagramItem *item);
	void EdgeInserted(Edge *item);
	void updateActions();
	void properties();
	void inTrans();
	DiagramItem *selectedDiagramItem() const;
    Edge *selectedEdge() const;
	void print();
	void printPNG();
	void grid();
	void numbering();
	void filtering();
	void unfiltering();
	void reverse();
	void bringToFront();
	void sendToBack();
	void documentWasModified();
	void sceneScaleChanged(const QString &scale);
	void saveSBML();
	//void generateAutoLayout();
	void addRightBranching();
	void addLeftBranching();
	void selectAll();
        


private:
	void createActions();
	void createMenus();
	void createToolBar();
	void createToolBox();

    void loadFile(const QString &fileName, const int &index);
	void setCurrentFile(const QString &fileName);
	QString strippedName(const QString &fullFileName);
	bool maybeSave(const int &index);
	bool saveFile(const QString &fileName);
    QWidget *createCellWidget(const QString &text, DiagramItem::DiagramType type);
	QWidget *createCellWidget(const QString &text, Edge::EdgeType type);

	Scene *scene;

	QMenu *fileMenu;
	QMenu *editMenu;
	QMenu *helpMenu;
	
	QAction *newAction;
	QAction *openAction;
	QAction *saveAction;
	QAction *saveAsAction;
	QAction *aboutAction;
	QAction *exitAction;
	QAction *importAction;
	QAction *exportAction;
	QAction *deleteAction;
	QAction *propertiesAction;
	//QAction *deleteAllAction;
	QAction *inTransAction;
	QAction *printAction;
	QAction *printPNGAction;
	QAction *gridAction;
	QAction *numberingAction;
	QAction *filteringAction;
	QAction *unfilteringAction;
	QAction *reverseAction;
	QAction *bringToFrontAction;
	QAction *sendToBackAction;
	QAction *sbmlAction;
	//QAction *autoLayoutAction;
	QAction *branchRightAction;
	QAction *branchLeftAction;
	QAction *selectAllAction;

    QToolBar *fileToolBar;
    QToolBar *editToolBar;
	QToolBar *viewToolbar;
        //QToolBar *convertToolBar;

	QSpacerItem *space1;
	QSpacerItem *space2;
	QSpacerItem *space3;

	QTabWidget *tab;
	QTextEdit *SBMLText;
	QTextEdit *MIMMLText;
	QToolBox *toolBox;
	QGraphicsView *view;
	QButtonGroup *buttonGroup;
	QComboBox *sceneScaleCombo;
	QGraphicsTextItem* addNumber;
	QString curFile;
	QFileInfo mainFile;

	QPrinter *printer;
	QPainter *painter;

};


#endif
